// TOWN DIALOGUE SCRIPT
//    Town 132: Fenris Port

begintalkscript;

variables;

short i,j,k,r1,choice;

// Johanna

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Johanna";
	text1 = "A serious woman with a predatory gaze works the bar. She looks at your nice armor and weapons and automatically calculates ten ways to relieve you of your money.";
	text2 = "_I'm Johanna. Welcome to my bar. We have many services for a skilled individual like yourself._";
	text5 = "Johanna watches you carefully, her mind constantly calculating how much money she can get out of you. _Need anything, bold adventurer?_";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What can I get here?_";
	text1 = "She lists the services in a clipped, businesslike manner. _We have fine rooms. Only ten coins for the night and no sailors stinking them up. Also, we have excellent whiskey, five coins a round, good enough for a warrior like you._";
	
begintalknode;
	state = 2;
	nextstate = -1;
	condition = coins_amount() >= 10;
	question = "_I'll take that fine room._ Pay ten coins.";
	text1 = "She quickly leads you to a rather pleasant room and returns to the bar. Ten coins is pretty expensive for this bare, chilly chamber, but you still have a restful night.";
	action = END_TALK;	
	code =
		revive_party();
		change_coins(-10);
		relocate_char(get_pc_id(0),44,47,FALSE);
		relocate_char(get_pc_id(1),45,47,FALSE);
		relocate_char(get_pc_id(2),45,48,FALSE);
		relocate_char(get_pc_id(3),44,48,FALSE);
	break;

begintalknode;
	state = 2;
	nextstate = 3;
	condition = coins_amount() >= 5;
	question = "_Some excellent whiskey all around._ Pay five coins.";
	text1 = "The whiskey is cheap and burns your throat. They don't have alcohol this strong in Avernum. As you choke it down, Johanna leans close. _Want advice?_";
	code =
		force_char_status(30000,1,20);
		change_coins(-5);
	break;

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_Sure. What advice?_";
	text1 = "She grins. _Good information, reasonably priced. I know a great way to make quick cash, only 25 coins. Also, I know a little something about the Anama. Twenty coins._";
	text2 = "She leans close. _And I even know of a wizard who is hiding on these islands. Fifty coins for that prime tidbit._";

begintalknode;
	state = 4;
	nextstate = -1;
	condition = coins_amount() >= 25;
	question = "_How can we make quick cash?_ Pay 25 coins.";
	text1 = "_Go to Shayder and buy a drink at the bar. The barkeep will send you to someone who'll give you sweet courier jobs._";
	code =
		change_coins(-25);
	break;

begintalknode;
	state = 4;
	nextstate = -1;
	condition = coins_amount() >= 20;
	question = "_What do you know of the Anama?_ Pay 20 coins.";
	text1 = "_They're nuts, and when you join you can't use magic anymore, but they'll give you priest spells and lots of other stuff. If you want in, you can snow them easy. Just go to all the priests in the small towns, and always agree with them. Then find Ahonar._";
	code =
		change_coins(-20);
	break;

begintalknode;
	state = 4;
	nextstate = -1;
	condition = coins_amount() >= 50;
	question = "_Wizard? Where?_ Pay 50 coins.";
	text1 = "_Don't know his name, but he's hiding in the ruins of Kneece. You can get a ferry there in Kuper, to the south._";
	code =
		change_coins(-50);
	break;

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_Any advice I can get for free?_";
	text1 = "_Yeah. Never forget. You can't get anything for free._ She goes off to hunt for paying customers.";
	action = END_TALK;

begintalknode;
	state = 2;
	nextstate = -1;
	question = "_I don't need anything._";
	text1 = "_Oh._ She walks off.";
	action = END_TALK;

// Kurtz

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Kurtz";
	text1 = "A weary old man is sitting behind the table, grinding herbs into powder and mixing them with odd liquids to make in. He puts the mixture under the counter when you approach.";
	text2 = "_I'm Kurtz,_ he says, after carefully wiping his hands clean.";
	text5 = "Kurtz watches you silently. The smell of the freshly crushed herbs is starting to make you feel light-headed.";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_What were you working on?_";
	text1 = "He pretends to not know what you're talking about.";

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_What are you doing?_";
	text1 = "He wipes some gray powder off his fingers. _I use my alchemy to create scrolls. A tricky thing to do on this island._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_What isn't safe on this isle?_";
	text1 = "_Let's just say that alchemy is much more acceptable on the Isle of Bigail then things that smell of magic, like making scrolls. The Anama see to that._";
	text3 = "_Let's just say that alchemy is much more acceptable on the Isle of Bigail than things that smell of magic, like making scrolls. You Anama see to that._";
	code =
		if (has_spec_item(40) == 0)
			remove_string(3);
			else remove_string(1);
	break;

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_What sort of scrolls do you make?_";
	text1 = "_You bring me a sheet of papyrus and magical herbs. I will tell you what I can make for you._";
	code =
		sf(132,14,1);
	break;
	
begintalknode;
	state = 31;
	nextstate = 32;
	question = "_What other services are you offering?_";
	text1 = "_Well, for a mere 100 coins, I'll tell you where you can find fresh ingredients._";


begintalknode;
	state = 32;
	nextstate = 29;
	condition = coins_amount() >= 100;
	question = "_Where can we get fresh ingredients for our alchemy potions?_";
	text1 = "He says, _Well, good ingredients are hard to find, but not impossible. Go to the swamp to the northwest and look for a big rock outcropping. Look just to the north of it._";
	code =
		change_coins(-100);
	break;
	
begintalknode;
	state = 32;
	nextstate = 29;
	question = "_Not interested._";
	text1 = "_Fair enough._";

begintalknode;
	state = 29;
	nextstate = 36;
	condition = gf(132,12) >= 1;
	question = "_The Anama priest here says that he doesn't trust you._";
	text1 = "_He's Anama. They don't trust anybody._";
	
begintalknode;
	state = 36;
	nextstate = -1;
	condition = has_spec_item(40) > 0;
	question = "_Why don't the Anama trust you?_";
	text1 = "He notes your Anama ring. _No idea._";
	
begintalknode;
	state = 36;
	nextstate = 37;
	condition = has_spec_item(40) == 0;
	question = "_Why don't the Anama trust you?_";
	text1 = "He notes your lack of an Anama ring. _Well, some of the goods I sell ... they contain magic. I'll sell them to you, as long as you keep it to yourself._";
	
begintalknode;
	state = 37;
	nextstate = -1;
	condition = 1;
	question = "_Let me see your wares._";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Kurtz's Magic",
		  "Kurtz breaks the laws of the Anama sometimes. That's why he'll sell these goods to you.",
		  61,5,0);	
	break;
	
begintalknode;
	state = 29;
	nextstate = 35;
	condition = gf(132,14) > 0;
	question = "_Can you make a scroll for me?_";
	text1 = "_If you bring me healing, energetic, and spiritual herbs, and a blank scroll, I can infuse the paper with magical power. If you have graymold or mandrake, I can do even more._";

begintalknode;
	state = 35;
	condition = num_of_item(267) >= 1 && num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1;
	question = "_I would like a lightning scroll._ (Give paper and 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work making the ink. After an hour, the scroll has been completed.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(267,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		reward_give(121);
		play_sound(22);
	break;

begintalknode;
	state = 35;
	condition = num_of_item(267) >= 1 && num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1;
	question = "_I would like a domination scroll._ (Give paper and 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work making the ink. After an hour, the scroll has been completed.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(267,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		reward_give(122);
		play_sound(22);
	break;

begintalknode;
	state = 35;
	condition = num_of_item(267) >= 1 && num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1;
	question = "_I would like a healing scroll._ (Give paper and 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work making the ink. After an hour, the scroll has been completed.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(267,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		reward_give(231);
		play_sound(22);
	break;

begintalknode;
	state = 35;
	condition = num_of_item(267) >= 1 && num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1 && num_of_item(292) >= 1;
	question = "_I would like a sanctification scroll._ (Give paper, graymold, and 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work making the ink. After an hour, the scroll has been completed.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(267,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		take_num_of_item(292,1);
		reward_give(498);
		play_sound(22);
	break;

begintalknode;
	state = 35;
	condition = num_of_item(267) >= 1 && num_of_item(289) >= 1 && num_of_item(290) >= 1 && num_of_item(291) >= 1 && num_of_item(293) >= 1;
	question = "_I would like a spellward scroll._ (Give paper, mandrake, and 1 sprig each of healing, spiritual, and energetic herbs.)";
	text1 = "You give him the herbs, and he sets to work making the ink. After an hour, the scroll has been completed.";
	action = REUSABLE;
	code = 
		inc_flag(190,7,1);
		take_num_of_item(267,1);
		take_num_of_item(289,1);
		take_num_of_item(290,1);
		take_num_of_item(291,1);
		take_num_of_item(293,1);
		reward_give(233);
		play_sound(22);
	break;
	
begintalknode;
	state = 35;
	nextstate = -1;
	question = "_I don't need a scroll._";
	text1 = "_No worries, then._";
	action = END_TALK;
	
// Gavlax

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Gavlax";
	text1 = "An Anama priest stands at the altar. He watches you skeptically.";
	text2 = "_Greetings, travelers. I am Father Gavlax._ He's clearly not pleased to be talking to you.";
	text5 = "Father Gavlax still looks very worried about you. You aren't sure why. Maybe he knows that you're an Avernite.";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_May I speak with you?_";
	text1 = "_Yes. I lead the few Anama in this foul place. And I was instructed to discuss the faith with the likes of you._ He frowns. _I could be happier._";

begintalknode;
	state = 58;
	nextstate = -1;
	question = "_Who instructed you to discuss your faith with us?_";
	text1 = "_I would rather not say. You have been discussed. Leave it at that._";

begintalknode;
	state = 58;
	nextstate = -1;
	question = "_Tell me about the Anama._";
	text1 = "_We are people who have rejected magic. I have been instructed to discuss our faith with you, even though everyone knows adventurers are constant magic users. But I follow orders._ He looks at you with distaste.";
	text3 = "_We are glad to have you among our number. However, you should avoid this place. The sailors here will gladly lead you astray._";
	code =
		if (has_spec_item(40) == 0)
			remove_string(3);
			else remove_string(1);
	break;

begintalknode;
	state = 58;
	nextstate = 59;
	question = "_Why did you call this a foul place?_";
	text1 = "_Fenris Port is a place of sailors, illicit activities, and crime. There are few Anama here, and we're about the only people who do honest work._";

begintalknode;
	state = 58;
	nextstate = -1;
	condition = has_spec_item(40) <= 0;
	question = "_Well, I'd like to discuss your faith in more detail._";
	code =
		run_hardcode(128);
	break;

begintalknode;
	state = 59;
	nextstate = -1;
	question = "_What illicit activities are going on?_";
	text1 = "_Well, let's just say that not everything Kurtz buys was obtained legally. I do not trust him._";
	action = SET_SDF 132 12 1;

// Volb

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 85;
	question = "Volb";
	text1 = "A man in rags stands at the dock, selling tickets. His feet are bare. _I'm Volb. Would you like a ticket back to the mainland?_";
	text5 = "Volb shivers in the cool sea breeze. _Would you like a ticket?_";
	action = INTRO;

begintalknode;
	state = 85;
	nextstate = 86;
	question = "_What are the tickets for?_";
	text1 = "_I sell boat tickets to across the channel. Would you like to purchase one? Only 10 coins._";

begintalknode;
	state = 86;
	nextstate = 87;
	question = "_What town does the boat travel to?_";
	text1 = "He looks nervous. _I forget to what town. The one just across the water. I only just became a salesman._";

begintalknode;
	state = 87;
	nextstate = 85;
	question = "_What happened to the last salesman?_";
	text1 = "_The other guy doing it got diseased by a roach. I took over. Real sad what happened, but I don't mourn too much. I'm hungry!_";

begintalknode;
	state = 85;
	nextstate = -1;
	question = "_I want to buy a ticket._ Pay ten coins.";
	text1 = "He takes your gold and gives you a ticket. _Go to the end of the middle dock, and the ferry will take you to ... well ... wherever you're going._";
	text3 = "He says _I'm really sorry, but I have to get the money._ He genuinely looks apologetic. _Oh, never mind. Here you go._ He gives you a ticket.";
	text5 = "You have already bought this.";
	action = END_TALK;
	code =
		cs();
		if (gf(132,11) > 0)
			as(5);
			else if (coins_amount() < 10) {
				sf(132,11,1);
				as(3);
				}
				else {
					change_coins(-10);
					sf(132,11,1);
					as(1);
					}
	break;

begintalknode;
	state = 85;
	nextstate = -1;
	question = "_I don't need a ticket._";
	text1 = "_Wait. What? You sure? Oh. All right._";
	action = END_TALK;
				

